<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>添加会议</title> 

    <style type="text/css">
        @import url("/pages/import/base.css");
        html, body{ margin:0; height:100%; }
    </style>
    <script type="text/javascript" src="/pages/import/base.js"></script>

<style type="text/css">
    html, body{ margin:0; height:100%;width: 100%;overflow: auto;}
</style>



<body>
   <table class="editTable" style="text-align: center;" >
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">会议概览</span>
                </div>
            </td>
        </tr>               
        <tr>
            <td class="label">会议标题</td>
            <td colspan="3">
                <input id='title' class="easyui-textbox" data-options="required:false,width:554,editable:true">
            </td>
        </tr>
         <tr>
            <td class="label">主持人</td>
            <td >
                <input id='compere' class="easyui-combobox" data-options="required:false,width:200,editable:true">
            </td>          
            </td>

            <td class="label">会议日期</td>
            <td >
                <input id='date' class="easyui-datebox" data-options="required:false,width:200,editable:true">
            </td>

        </tr>                
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">会议详情</span>
                </div>
            </td>
        </tr>         
        <tr>
            <td colspan="4">
                <div class="easyui-panel" style="width: 700px; margin-left: 143px; margin-top: 0px" data-options=" border:false">
                    <table id="dg3" class="easyui-datagrid" title="" style="width:554px;height:auto"
                        data-options="
                            iconCls: 'icon-edit',
                            singleSelect: true,
                            toolbar: '#tb',
                            method: 'get'
                        ">
                    <thead>
                    <tr>
                        <th field="id" hidden="true">编号</th>
                        <th field="pid" hidden="true">父编码</th>
                        <th field="project_id" hidden="true">项目编号</th>
                        <th field="project_text">项目名称</th>
                        <th field="plan_name">任务</th>
                        <th field="developer" hidden="true"></th>
                        <th field="developer_text">执行者</th>
                        <th field="deadline" formatter='datagridFormatDateYMD'>截止日期</th>
                    </tr>
                    </thead>
                    </table>
                    <div id="tb" style="height:35px">
                            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-plus',plain:true" onclick="add()">新增</a>
                            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-trash',plain:true" onclick="dele()">删除</a>
                            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-check',plain:true" onclick="edit()">修改</a>
                    </div>
                </div>
            </td>
        </tr>

        <tr style="margin-top: 100px">
            <td></td>
            <td >
            </td>
            <td>
            </td>
            <td  style="text-align: right;margin-top: 100px">
                  <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-save',plain:true" onclick="save()" style="color:black;width:80px;height:auto;background-color: #00CD66">保存</a>
            </td>               
        </tr>          
    </table>
    
</body> 
</html>
<script type="text/javascript">
    var row;
    $(function(){
        row = Easyui.Datagraid.getParentSelectRow('dg');
        $('#title').textbox('setValue',row.title);
        $('#date').datebox('setValue',row.date);
        $('#compere').combobox({
            url: '/system/user/getAllSelectUser.do',
            valueField: 'id',
            textField: 'name',
            panelHeight: 200,
            method: 'get',
            multiple: false,
            queryParams: {
                // 'name': 'getCompanyForList'
            },
            onLoadSuccess: function() {
                $('#compere').combobox('setValue',row.compere);
            },
            onSelect: function(ret) {}
        });

        $('#dg3').datagrid({
            url: '/develop/url/getUrl.do',
            queryParams: {
                name: 'getMeetDatailListByPid',
                pid:row.id
            },
            method: 'get',
            onDblClickCell:function(index,field,value){
            }
        })   


    })


    function save() {

        shuoheUtil.layerTopMaskOn();

        var o = new Object();
        o = row;
        o.title = $('#title').textbox('getValue');
        o.date = $('#date').datebox('getValue');
        o.compere = $('#compere').combobox('getValue');

        var rows = $('#dg3').datagrid('getRows');

        $.ajax({
            url:'/pm2/meeting/save.do',
            type: "POST",
            dataType: 'json',
            data: {
                'data': JSON.stringify(o),
                'detail':JSON.stringify(rows)
            },
            error: function() //失败
            {
                shuoheUtil.layerTopMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerTopMaskOff();
                if (data.result == true) {
                    shuoheUtil.layerClose();
                    parent.updateSuccess();
                } else
                    shuoheUtil.layerMsgCustom(data.describe);
            }
        });
    }
</script>
<script type="text/javascript">
    function add()
    {
          layer.open({
              type: 2,
              title: '新增详情',
              shadeClose: false,
              shade: 0.3,
              maxmin: true, //开启最大化最小化按钮s
              area: ['800px','400px'],
              content: 'addDetail.jsp'
          })
    }
    function edit()
    {
        layer.open({
            type: 2,
            title: '修改详情',
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮s
            area: ['800px','400px'],
            content: 'editDetail.jsp'
        })
    }
    function dele()
    {
        Easyui.Datagraid.deleteSeleectRow('dg3');
    }
</script>